<?php
/**
 * Created by PhpStorm.
 * User: dayu
 * Date: 2019/12/19
 * Time: 15:56
 */

namespace app\Validate;


class GoodsValidate extends RequestValidate
{

    protected function rulesList()
    {
        switch ($this->action) {
            case 'goodsCategoryList':
                return [
                    'pid' => 'require|integer|>=:0'
                ];
            //商品信息w
            case 'getGoodsInfo':
                return [
                    'goods_id' => 'require|integer|>:0',
                ];
            //商品订单创建
            case 'createGoodsOrder':
                return [
                    'order_type' => "require|integer|>:0",//订单类型
                    'goods_sku_list' => "require",//商品信息
                    'addres_id' => "require|integer|>:0",//收货地址
                    'buyer_message' => "sometimes|require|chsDash",//买家附言
                    'coupon_id' => "sometimes|require|integer|>:0",//订单代金券id
                ];
            //首页3大分类商品列表
            case 'HomeGoodsList':
                return [
                    'type' => "require|integer|between:1,3",//
                    'pag' => "sometimes|require|integer|>:0",
                    'number' => "sometimes|require|integer|>:0",
                    'variety_id_activation' => "sometimes|require|integer|>=:0",//激活参数 左右可以指定分类查找商品
                ];
            //自定义分类列表
            case 'VarietyList':
                return [
                    'level' => "sometimes|require|integer|between:1,3",
                    'pag' => "sometimes|require|integer|>:0",
                    'number' => "sometimes|require|integer|>:0",
                    'variety_id_activation' => "sometimes|require|integer|>:0",//激活参数 左右可以指定分类查找商品
                ];
             //自定义分类集合
            case 'VarietyGather':
                return [
                    'variety_id' => "require|integer|>:0",//激活参数 左右可以指定分类查找商品
                ];

            //指定父级自定义分类列表
            case 'ParentVarietyList':
                return [
                    'variety_id' => "require|require|integer|>:0",//是否支持排序
                    'sort' => "sometimes|require|integer|accepted",//是否支持排序
                    'place' => "sometimes|require|integer|between:1,3",//指定位置
                    'pag' => "sometimes|require|integer|>:0",
                    'number' => "sometimes|require|integer|>:0",
                ];
            //分类商品列表
            case 'RecommendGoods':
                return [
                    'category_id' => "require|require|integer|>:0",//是否支持排序
                    'order' => "require|require|integer|between:1,7",//指定位置
                    'pag' => "sometimes|require|integer|>:0",
                    'number' => "sometimes|require|integer|>:0",
                ];






        }
    }

}